﻿using System;
using System.Collections.Generic;
using System.Windows;
using MyControl;

namespace test_window {

  #region 主窗口
  /// <summary>
  /// 主窗口
  /// </summary>
  #endregion
  public partial class MainWindow : Window {

	#region 创建主窗口
	/// <summary>
	/// 创建主窗口
	/// </summary>
	#endregion
	public MainWindow() {
	  // 初始化控件
	  InitializeComponent();
	  // 初始化数据
	  this.InitData();
	}

	#region 初始化数据
	/// <summary>
	/// 初始化数据
	/// </summary>
	#endregion
	private void InitData() {
	  List<Tree> rootTree = new List<Tree>() {
		new Tree("级别1", new List<Tree>() {
			new Tree("级别1-1", "值：级别1-1"),
			new Tree("级别1-2", "值：级别1-2"),
		  }),
		new Tree("级别2", new List<Tree>() {
			new Tree("级别2-1", "值：级别2-1"),
			new Tree("级别2-2", new List<Tree>() {
				new Tree("级别2-2-1 特别长的标签名称","值：级别2-2-1"),
			  }),
		  }) ,
		new Tree("级别3", new List<Tree>() {
			new Tree("级别3-1", "值：级别3-1"),
			new Tree("级别3-2", "值：级别3-2"),
			new Tree("级别3-3", "值：级别3-3"),
			new Tree("级别3-4", "值：级别3-4"),
			new Tree("级别3-5", "值：级别3-5"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
			new Tree("级别3-6", "值：级别3-6"),
		  }),
	  };
	  this.unionSelector.OptionData = rootTree;
	  //this.unionSelector.SelectIndexList = new List<int>() { 1,1,0 };
	  //this.unionSelector.SelectValue = "值：级别2-2-1";
	  this.unionSelector.SelectNameList = new List<string> { "级别2", "级别2-2", "级别2-2-1 特别长的标签名称" };
	}

	#region 联合选择框_内容发生变化
	/// <summary>
	/// 联合选择框_内容发生变化
	/// </summary>
	/// <param name="sender">触发元素</param>
	/// <param name="e">事件信息</param>
	#endregion
	private void unionSelector_SelectValueChange(object sender, SelectValueChangeEventArgs e) {
	  Console.WriteLine("旧值：" + e.OldSelectValue);
	  Console.WriteLine("新值：" + e.SelectValue);
	}
  }
}
